<template lang="pug">
  div {{token}}
</template>

<script>
  import {tieAgentUser} from '@/api/getData'

  export default {  
    name: "analysisCode",
    data() {
      return {
        code: '',
        token: ''
      }
    },
    created() {
      let code = this.$route.query.code;
      this.code = code;
      let id= this.$route.query.state+"";
      this.id=id;
      this.login(code);
    },
    methods: {
      async login(code) {
        //用code换取openId
        let obj = await tieAgentUser({code:this.code,id:this.id});
        console.log(obj);
        if (obj._result) {
          this.token="绑定成功！请关闭页面！"
        }
      }
    }

  }
</script>

<style scoped>

</style>
